<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h2>axios的GET请求带参数的形式</h2>
    省份<input type="text" name="province" value="浙江省"/>
    城市<input type="text" name="city" value="杭州市">
    <button>测试</button>
    <ul></ul>
    
    <script src="./lib/axios.js"></script>
    <script>
      const proin = document.querySelector('input[name=province]');
      const cityin = document.querySelector('input[name=city]');
      const list = document.querySelector('ul');
      document.querySelector('button').addEventListener('click',async function () {
        const {data:{data,message}} = await axios.get('http://ajax-api.itheima.net/api/area',{params:{
            pname:proin.value,
            cname:cityin.value
          }})
          list.innerHTML=message
          list.innerHTML+=data.map(item=>{
            return `<li>${item}</li>`
          }).join('')
      });
    </script>
</body>
</html>